<div class="panel-base panel-admin">
	<div class="panel-admin-inner">		
		<div>			
			<img id="img-preview" style="width:600px; height:300px; border:1px solid #222" />						
		</div>
		<div>		
			<form id="frm-add" action="<?php print base_url(); ?>admin/carousel/add/submit" method="post" enctype="multipart/form-data">			
				<input type="file" name="fc" id="fc" style="display:none;" onchange="readURL(this, $('#img-preview'));" /><br />
				<ul class="unstyled">
					<li>
						<span class="span2">รูปภาพ</span>						
						<div class="input-append">
							<input type="text" id="img-path" class="input-large">
							<a class="btn" id="inv-fc">Browse</a>
						</div>
					</li>					
					<li><span class="span2">คำอธิบาย</span><textarea class="desc span6" name="desc" rows="4"></textarea></li>				
					<li><span class="span2">วันที่เริ่ม: </span><input type="text" class="span2 dtpicker" name="dps" value="<?php print date('Y-m-d'); ?>" /></li>
					<li><span class="span2">วันที่สิ้นสุด: </span><input type="text" class="span2 dtpicker" name="dpe" /></li>
					<li><span class="span2">คงเหลือ: </span><span id="d-remain"></span></li>
				</ul>	
			</form>					
		</div>
		<div>			
			<div class="btn-toolbar">
				<div class="btn-group">				
					<a href="#modal-add-item" role="button" data-toggle="modal" class="btn btn-primary">บันทึกข้อมูล</a>					
				</div>
				<div class="btn-group">
					<a role="button" class="btn">ยกเลิก</a>
				</div>
			</div>			
		</div>		
	</div>	
</div>

<!-- Add Item Modal -->
<div id="modal-add-item" class="modal hide fade" role="dialog" aria-hidden="true">
	<div class="modal-header">		
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h5>เพิ่มข้อมูล</h5>		
	</div>
	<div class="modal-body">					
		<p>ยืนยันการเพิ่มข้อมูล</p>		
	</div>
	<div class="modal-footer">
		<button class="btn" data-dismiss="modal" aria-hidden="true">ยกเลิก</button>
		<button class="btn btn-primary" id="btn-add-submit">ตกลง</button>
	</div>
</div>

<script type="text/javascript">
	$(function(){	

		$('#btn-add-submit').click(function(){
			$('#frm-add').submit();
		});
		$('#inv-fc').click(function(){
			$('#fc').trigger('click');			
		});
		$('#fc').change(function(){
			$('#img-path').val($(this).val());
		});
		$('.dtpicker').datepicker({
			dateFormat	: 'yy-mm-dd'
		});
	});
</script>

